﻿using System.Collections.Generic;

namespace AjaxAvailableUserControls.Library.Logic
{
    /// <summary>
    /// Response from server side method sending to the client side 
    /// </summary>
    public class AjaxResponse
    {
        #region fields & properties
        /// <summary>
        /// Current shown page in client datasource
        /// </summary>
        public int CurrentPage
        {
            get;
            set;
        }

        /// <summary>
        /// Total pages in the client datasource
        /// </summary>
        public int TotalPages
        {
            get;
            set;
        }

        /// <summary>
        /// Total resords in the client datasource
        /// </summary>
        public int TotalRecords
        {
            get;
            set;
        }

        /// <summary>
        /// Custom Recourds to be attached as rows to client datasource in paging behavior
        /// </summary>
        public List<object> Records
        {
            get;
            set;
        }

        /// <summary>
        /// Additional settings to send to the client side
        /// </summary>
        public object AdditionalSettings
        {
            get;
            set;
        }

        /// <summary>
        /// Error messages to parse on the client side
        /// </summary>
        public string ErrorMessages
        {
            get;
            set;
        }

        private bool isLastPage = false;

        /// <summary>
        /// Current page is last? flag
        /// </summary>
        public bool IsLastPage
        {
            get
            {
                return this.isLastPage;
            }
            set
            {
                this.isLastPage = value;
            }
        }
        #endregion
    }
}
